package com.ps.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ps.pojo.Systemconfig;
import com.ps.service.SystemconfigService;
import com.ps.utils.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 系统配置表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2020-12-18
 */
@RestController
@RequestMapping("/qx/xqlxsz")
public class SystemconfigController {
    @Resource
    private SystemconfigService systemconfigService;
    @GetMapping("/getAll")
    @ResponseBody
    public Result getAll(Integer page, Integer limit, Systemconfig systemconfig){
        Page<Systemconfig> all = systemconfigService.getAll(page, limit, systemconfig);
        return Result.success(all);
    }
    @PostMapping("/add")
    @ResponseBody
    public Result add(Systemconfig systemconfig){
        Result result=new Result();
        if (systemconfigService.add(systemconfig)) {
            result.setMsg("添加成功！");
        }else {
            result.setMsg("添加失败!");
        }
        System.out.println(systemconfig);
        return result;
    }
    @PostMapping("/update")
    @ResponseBody
    public Result update(Systemconfig systemconfig){
        Result result=new Result();
        if (systemconfigService.updateById(systemconfig)) {
            result.setMsg("修改成功！");
        }else {
            result.setMsg("修改失败!");
        }
        return result;
    }
    @PostMapping("/del")
    @ResponseBody
    public Result del(Integer id){
        Result result=new Result();
        if (systemconfigService.removeById(id)) {
            result.setMsg("删除成功！");
        }else {
            result.setMsg("删除失败!");
        }
        return result;
    }
}

